package br.com.statizo.financeiro;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.data.time.Month;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;



public class JFreeTEst extends ApplicationFrame{

	public JFreeTEst(String title) {
		super(title);

		
		TimeSeriesCollection coll = new TimeSeriesCollection();
		
		TimeSeries s1 = new TimeSeries("Despesa");
		s1.add(new Month(1,2012),1500);
		s1.add(new Month(2,2012),1200);
		s1.add(new Month(3,2012),1700);
		s1.add(new Month(4,2012),2400);
		
		TimeSeries s2 = new TimeSeries("Receita");
		s2.add(new Month(1,2012),3000);
		s2.add(new Month(2,2012),3500);
		s2.add(new Month(3,2012),3200);
		s2.add(new Month(4,2012),4000);
		
		coll.addSeries(s1);
		coll.addSeries(s2);
		

		JFreeChart jfc = ChartFactory.createTimeSeriesChart("Relatório anual de despesas e receitas", "Meses", "Valor (R$)", coll, true, true, false);
		ChartPanel chartPanel = new ChartPanel(jfc);
		
		chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
	    setContentPane(chartPanel);		
		
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	
	
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		 
		final JFreeTEst demo = new JFreeTEst("ATeste");
	        demo.pack();
	        RefineryUtilities.centerFrameOnScreen(demo);
	        demo.setVisible(true);
		

	}

}
